/**
 * Created by Administrator on 2017/3/21.
 */

//用户修改密码
$('#user-info').click(function(){
    var id= $('#user-info').attr('data-index');
    layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
        layer.close(index);
        layer.prompt({title: '请再次输入密码，并确认', formType: 1}, function(text, index){
            layer.close(index);
            if(pass!=text){
                layer.msg('两次输入密码不一致');
            }
            $.post('/index.php/Home/User/edit_pass',{id:id,pass:pass},function(resutl){
                if(!resutl.success){
                    layer.msg(resutl.message);
                }
                layer.msg(resutl.message,function(){
                    window.location.href="/index.php/Home/User/login";
                });
            });
        });
    });
});
//用户退出
$('#user-logout').click(function(){
    var id= $('#user-info').attr('data-index');
    //询问框
    layer.confirm('您确定要退出该系统？', {
        title:'<span style="color: red">警告</span>',
        btn: ['确定','取消'] //按钮
    }, function(){
        $.post('/index.php/Home/User/logout',function(resutl){
            layer.msg(resutl.message,function(){
                window.location.href="/index.php/Home/User/login";
            });
        });
    });
});

/*//支付方式管理
$('#pay-setting').click(function(){

});*/
